package be.vdab.filters;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

/**
 * Servlet Filter implementation class ServletFilter
 */
@WebFilter("*.htm")
public class ServletFilter implements Filter {
	private String encoding;
	
	public void init(FilterConfig filterConfig) throws ServletException {
		if(filterConfig!=null){
			encoding = filterConfig.getInitParameter("encoding");
		}
		System.out.println("----------------------------------------------------#"+ encoding + "#");
	}
	
	public ServletFilter() {
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see Filter#destroy()
	 */
	public void destroy() {
		// TODO Auto-generated method stub
	}

	/**
	 * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
	 */
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
	//	request.setCharacterEncoding(encoding);
		chain.doFilter(request, response);
	}

	
	

}
